package com.mashibing.controller;

import com.mashibing.internalcommon.dto.PassengerUser;
import com.mashibing.internalcommon.dto.ResponseResult;
import com.mashibing.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/getUser")
    public ResponseResult<PassengerUser> getUser(HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        return userService.getUser(token);
    }
}
